package ca.ubc.icapture.genapha.forms;

import icapture.SQLMgr;
import icapture.beans.DB.Ethnicity;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;


/**
 * Created by IntelliJ IDEA.
 * User: btripp
 * Date: Sep 13, 2006
 * Time: 9:39:23 AM
 * To change this template use File | Settings | File Templates.
 */
public class FbatStratifyForm extends AnalysisFilesForm
{

    private ArrayList<Ethnicity> availableEthnicities;
    private String[] selectedEthnicity;

    public FbatStratifyForm()
    {
        super();
        setPhenotypes(SQLMgr.getPhenotypes());
    }

    @Override
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
    {
        ActionErrors errors = new ActionErrors();

//       if(selectedPhenotype.length()==0)
//            errors.add("selectedPhenotype",new ActionMessage("error.entry.required"));
//       if(selectedCohort==null || selectedCohort[0]==null || selectedCohort[0].length()==0)
//            errors.add("selectedCohort",new ActionMessage("error.entry.required"));
//       if(email!=null){
//           if(email.length()==0)
//                errors.add("email",new ActionMessage("error.entry.required"));
//           else if(!email.contains("@"))
//                errors.add("email",new ActionMessage("error.entry.invalid.email"));
//       }
//        if(selectedEthnicity!=null){
//            if(selectedEthnicity.length == 0 )
//                errors.add("selectedEthnicity",new ActionMessage("error.entry.required"));
//        }
//
        return errors;
    }

    /**
     * @return the availableEthnicities
     */
    public ArrayList<Ethnicity> getAvailableEthnicities()
    {
        return availableEthnicities;
    }

    /**
     * @param availableEthnicities the availableEthnicities to set
     */
    public void setAvailableEthnicities(ArrayList<Ethnicity> availableEthnicities)
    {
        this.availableEthnicities = availableEthnicities;
    }

    /**
     * @return the selectedEthnicity
     */
    public String[] getSelectedEthnicity()
    {
        return selectedEthnicity;
    }

    /**
     * @param selectedEthnicity the selectedEthnicity to set
     */
    public void setSelectedEthnicity(String[] selectedEthnicity)
    {
        this.selectedEthnicity = selectedEthnicity;
    }
}
